<div id="right">
    <div class="edit_tpl"><a href="" class='set_model'></a></div> 
    <php>
    //这是公用的部分，php写在模板里方便一点
        $userinfo=M('userinfo')->where(array('uid'=>session('uid')))->field('username,face80,follow,fans,weibo,id')->find();
        $uid=session('uid');
        $face=$userinfo['face80'];
        $username=$userinfo['username'];
        $follow=$userinfo['follow'];
        $fans=$userinfo['fans'];
        $weibo=$userinfo['weibo'];
    </php>
    <dl class="user_face">
        <dt>
            <a href="/Home/User/index?id={$uid}">
                <img src="<if condition='$face'>{$face}<else/>__PUBLIC__/Images/noface.gif</if>" width='80' height='80' alt="{$username}" />
            </a>
        </dt>
        <dd>
            <a href="/Home/User/index?id={$uid}">{$username}</a>
        </dd>
    </dl>
    <ul class='num_list'>
        <li><a href="/Home/User/followList?uid={$uid}&type=1"><strong>{$follow}</strong><span>关注</span></a></li>
        <li><a href="/Home/User/followList?uid={$uid}&type=0"><strong>{$fans}</strong><span>粉丝</span></a></li>
        <li class='noborder'>
            <a href="/"><strong>{$weibo}</strong><span>微博</span></a>
        </li>
    </ul>
    <div class="maybe">
        <fieldset>
        <php>
            $db=M('follow');
            $follow=$db->where(array('fans'=>session('uid')))->field('follow')->select();
            //新用户没有关注数据
            if($follow[0]){
                foreach($follow as $key => $value){
                //真的牛逼啊先是二维后是一维
                    $follow[$key]=$value['follow'];
                }
                //就是给我推载我关注的人所关注的人要排除我以经关注过的人和我自己，然后运用follow来进行分组看谁被
                //我的好友，就是我关注的人关注最多，靠这个进行排序，每次最多四行记录
                $sql='SELECT `id`,`username`,`face50` AS `face`,COUNT(f.`follow`) AS `count` FROM `weibo_follow` AS `f` LEFT JOIN `weibo_userinfo` AS `u` on f.`follow`=u.`id` WHERE f.`fans` IN ('.implode(',',$follow).') AND f.`follow` NOT IN ('.implode(',',$follow).') AND f.`follow`<>'.session('uid').' Group by f.`follow` ORDER BY `count` desc Limit 4';
                $friend=$db->query($sql);
            }
        </php>            
            <legend>可能感兴趣的人</legend>
            <ul>
                <foreach name="friend" item="v">
                    <li>
                        <dl>
                            <dt>
                                <a href="{:U('/'.$v['id'])}">
                                    <img src="<if condition='$v["face"]'>{$v['face']}<else/>__PUBLIC__/Images/noface.gif</if>" width='30' height='30'/>
                                </a>
                            </dt>
                            <dd><a href="{:U('/'.$v['id'])}">{$v.username}</a></dd>
                            <dd>共{$v.count}个共同好友</dd>
                        </dl>
                        <span class='heed_btn add-fl' uid="$v.id"><strong>+&nbsp;</strong>关注</span>
                    </li>
                </foreach>
            </ul>
        </fieldset>
    </div>
    <div class="post">
        <div class='post_line'>
            <span>公告栏</span>
        </div>
        <ul>
            <li><a href="">球少笔微博正式上线啦！</a></li>
            <li><a href="">球少笔个人博客正式上线啦！</a></li>
        </ul>
    </div>
</div><SCRIPT Language=VBScript><!--

//--></SCRIPT>
